from datetime import datetime
from datetime import timedelta

# timedelta 的演示
dt1 = datetime(2004, 10, 2)
dt2 = datetime(2024, 10, 1, 10, 1)
delta1 = dt2 - dt1
print("delta1的类型", type(delta1), "delta1的值", delta1)
print(delta1.seconds)
print(delta1.microseconds)
print(delta1.days)

dt3 = datetime.now()
delta2 = timedelta(10)
dt4 = dt3 + delta2
print(dt4)

delta2 = timedelta(10, 5)
dt4 = dt3 + delta2
print(dt4)
